﻿

alter PROCEDURE [dbo].[PomPropertyImagePathAlter]
(
	@pPomplingAddressID INT,
	@pDisplayPicturePath VARCHAR(150),
	@pPictureTitle VARCHAR(100),
	--@pPicturePathOnHD VARCHAR(150),
	@pIsMainImage BIT,
	@pCrudType VARCHAR(25),
	@pPomplingCustomerID varchar(32)
)

AS
BEGIN
	IF @pCrudType = 'INSERT'
	BEGIN
		INSERT INTO [PomPropertyImages] ([PomplingAddressID],[DisplayPicturePath],[PictureTitle], [IsMainImage])
		VALUES (@pPomplingAddressID, @pDisplayPicturePath,@pPictureTitle, @pIsMainImage );
	END
	IF @pCrudType = 'DELETE_IMAGE'	
	BEGIN
		UPDATE [PomPropertyImages] SET IsDeleted = 1, [DeletedDate] = GETDATE() WHERE [PomplingAddressID] = @pPomplingAddressID AND [IsMainImage] = @pIsMainImage
	END	
END